package com.example.controller;


import com.example.common.Result;
import com.example.entity.Projectapply;
import com.example.service.RecordService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/record")
public class RecordController {

    @Autowired
    private RecordService recordService;



    /**
     * 新增
     */
    @PostMapping("/add")
    public Result add(@RequestBody Projectapply projectapply) {
        recordService.add(projectapply);
        return Result.success();
    }

    /**
     * 查询所有
     */
    @GetMapping("/selectAll")
    public Result selectAll(Projectapply projectapply ) {
        List<Projectapply> list = recordService.selectAll(projectapply);
        return Result.success(list);
    }
    /**
     * 分页查询
     */
    @GetMapping("/selectPage")
    public Result selectPage(Projectapply projectapply,
                             @RequestParam(defaultValue = "1") Integer pageNum,
                             @RequestParam(defaultValue = "10") Integer pageSize) {
        PageInfo<Projectapply> page = recordService.selectPage(projectapply, pageNum, pageSize);

        return Result.success(page);
    }
}
